<?php
//created date 20110717
include_once 'Shared/Models/Vacancy.php';
class vacancy_IndexController extends Vi_Controller_Action
{
	public function indexAction()
	{
		$objVacancy = new Models_Vacancy();
		$objPortal = new Models_Portal();
		$portalAlias = Vi_Registry::getAppName();
		$portal = $objPortal->getPortalbyAlias($portalAlias);
		$portal = current($portal);
		$portalId = $portal['portal_id'];
        $recentVacancy = $objVacancy->getRecentVacancy($portalId, 7);
        $this->view->recentVacancy = $recentVacancy;
	}
	public function moreAction()
	{
		$objVacancy = new Models_Vacancy();
		$objPortal = new Models_Portal();
		$portalAlias = Vi_Registry::getAppName();
		$portal = $objPortal->getPortalbyAlias($portalAlias);
		$portal = current($portal);
		$portalId = $portal['portal_id'];
		$objVacancy = new Models_Vacancy();
        $recentVacancy = $objVacancy->getRecentVacancy($portalId, 14);
        $this->view->recentVacancy = $recentVacancy;
	}
	public function detailAction()
	{
		//get param id
		$id   = $this->_getParam('id', false);
		$objVacancy = new Models_Vacancy();
		$vacancy = $objVacancy->getVacancybyId($id);
		$vacancy = current($vacancy);
		$this->view->vacancy = $vacancy;
		//$this->_redirect('http://www.tenantplus.com/');
	}
}